// pages/setting/setting.js
Page({

      /**
       * 页面的初始数据
       */
      data: {
            oldSetting:false,
            fontSize:'30rpx',
            loginStatus:false
      },
      about(){
            wx.navigateTo({
                  url: '/pages/about/about',
            })
      },
      openSetting(){
            wx.openSetting({})
      },
      // 老年人模式开关
      oldChange(e){
            this.setData({
                  oldSetting:e.detail.value
            })
            if(e.detail.value){
                  wx.setStorageSync('oldSetting',true);
            }else{
                  wx.removeStorageSync('oldSetting');
            }
      },

      quitLogin(){
            wx.showModal({
                  title: '提示',
                  content: '是否退出当前账号？',
                  success (res) {
                        if (res.confirm) {
                              wx.clearStorageSync();
                              wx.switchTab({
                                url: '/pages/index/index',
                              })
                        } else if (res.cancel) {
                        
                        }
                  }
                })
      },

      /**
       * 生命周期函数--监听页面加载
       */
      onLoad: function (options) {

      },

      /**
       * 生命周期函数--监听页面初次渲染完成
       */
      onReady: function () {

      },

      /**
       * 生命周期函数--监听页面显示
       */
      onShow: function () {
            let oldSetting=wx.getStorageSync('oldSetting');
            let userId=wx.getStorageSync('userId');
            if(userId==undefined || userId=='' || userId==null){
                  this.setData({
                        loginStatus:false
                  })
            }else{
                  this.setData({
                        loginStatus:true
                  })
            }
            if(oldSetting){
                  this.setData({
                        oldSetting:true
                  })
            }
      }
})